from django_filters.rest_framework import DjangoFilterBackend
from rest_framework import permissions
from rest_framework.decorators import permission_classes
from rest_framework.filters import OrderingFilter, SearchFilter

from backend import helper
from users.models import UserInfo
from users.serializers import UserFansSerializer


@permission_classes([permissions.IsAuthenticated])
class FanFollowViewSet(helper.MyModelViewSet):
    serializer_class = UserFansSerializer
    queryset = UserInfo.objects.all()

    filter_backends = [DjangoFilterBackend, OrderingFilter, SearchFilter]
    # TODO: ordering & filtering with `fans_count` field
